#include "players.h"

/*fleetManager-----------------------------------
 * the fleet manager holds all the top level fleets
 * available to the player.  mostly used for displaying
 * information, rather than maniopulating individual
 * units.  However it does have methods to access
 * specific Units.  Mostly made to make fleet-level
 * manipulatoion easier
 * --------------------------------------------*/
//constructors---------------
Players::fleetmanager::fleetmanager() {

}
Players::fleetmanager::~fleetmanager() {

}
//access---------------------
int Players::fleetmanager::activeCells() {
    map<int, Units::unitgroup*>::iterator itr;
    int size = 0;
    for(itr = fleetlist.begin(); itr != fleetlist.end(); itr++){
        size += itr->second->numUnits();
    }
}
int Players::fleetmanager::activeFleets() {
    return fleetlist.size();
}
Units::unit* Players::fleetmanager::gCell(int x, int y) {
    Units::unitLib::staticLib()->getUnit(x, y);
}
Units::unitgroup* Players::fleetmanager::gFleet(int id) {
    return fleetlist[id];
}
Units::unitgroup* Players::fleetmanager::gFleet(int x, int y) {
    return gCell(x,y)->getParent();
}
//manips---------------------
void Players::fleetmanager::endTurn(){

}
bool Players::fleetmanager::killFleet(int id){
    Units::unitgroup* u = fleetlist[id];
    list<Units::unit*>::iterator itr = u->unitIter();
    for(int i = 0; i < u->numUnits(); i++, itr++){
        u->remUnit(*itr);
    }
    delete u;
    fleetlist.erase(id);
}
bool Players::fleetmanager::killFleet(int x, int y){

}
int Players::fleetmanager::newFleet(){

}
void Players::fleetmanager::assignFleet(Units::unitgroup* ugp, Units::unit* u){

}
Units::unit* Players::fleetmanager::newCell(Units::unit* cell){

}
Units::unit* Players::fleetmanager::newCell(int fleetId, int x, int y){

}
